# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=captipper
pkgver=74.3fb2836
pkgrel=3
groups=('blackarch' 'blackarch-forensic' 'blackarch-malware' 'blackarch-sniffer')
pkgdesc='Malicious HTTP traffic explorer tool.'
arch=('any')
url='http://www.omriher.com/2015/01/captipper-malicious-http-traffic.html'
license=('Apache')
depends=('python2' 'python2-simplejson' 'python2-colorama')
makedepends=('git')
source=("$pkgname::git+https://github.com/omriher/CapTipper.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  find -name '*.py' -exec sed -i 's/env python$/env python2/' '{}' \;
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md README.txt
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md README.txt

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  ln -s /usr/share/captipper/CapTipper.py "$pkgdir/usr/bin/$pkgname"

  chmod +x "$pkgdir/usr/share/$pkgname/CapTipper.py"
}

